#include<stdio.h>
int main ()
{
	int count;
	int powers[10000];
	scanf("%d",&count);
	
	int deletePower;
	int deleteIndex=-1;
	int i;
	int insertPower;
	
	for(i=0;i<count;i++)
	{
		scanf("%d",&powers[i]);
	}
	scanf("%d",&deletePower);
	for(i=0;i<count;i++)
	{
		if(deletePower==powers[i])
		{
			deleteIndex=i;
			break;
		}
	}
	if(-1==deleteIndex)
	{
		for(i=0;i<count-1;i++)
		{
			printf("%d\t",powers[i]);
		}
		printf("%d\n",powers[count-1]);
	}
	else
	{
		for(i=deleteIndex;i<count-1;i++)
		{
			powers[i]=powers[i+1];
		}
		count--;
	
		
		for(i=0;i<count-1;i++)
		{
			printf("%d\t",powers[i]);
		}
		printf("%d\n",powers[count-1]);
	}
	
	
	
	return 0;
} 

